home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / c / uw_1.exe / UW_TUT2.C < prev    next >
Text File  |  1992-11-13  |  4KB  |  64 lines

  1. /****************************************************************************/
  2. /* UW_TUT2.C                                                                */
  3. /*                                                                          */
  4. /* NOTE: THIS FILE IS PUBLIC DOMAIN AND MAY BE MODIFIED AND USED AT WILL    */
  5. /*                                                                          */
  6. /* Now, before proceeding further, we will demonstrate UltraWin's powerful  */
  7. /* new debugging facility.  We take the same program but try to write       */
  8. /* text outside of the window's rectangle.  As you will see, UltraWin will  */
  9. /* detect and report this error.  UltraWin will detect virtually any        */
  10. /* pointer or parameter error when using the debug versions of the library. */
  11. /* Once your program is complete, you can rebuild with the normal library   */
  12. /* and increase performance and decrease code size!                         */
  13. /*                                                                          */
  14. /* When building this program, be sure to link in the debug version of the  */
  15. /* library.  For example, for Turbo/Borland C under small model, link in    */
  16. /* UWTSD.LIB.  For Microsoft C small model, link in UWMSD.LIB.              */
  17. /*                                                                          */
  18. /* NOTE: Notice that mv_cs is the function that reports the error. This is  */
  19. /*       due to the fact that wn_plst calls mv_cs.  Also notice that the    */
  20. /*       parameter displayed is the invalid argument, in this case 23!      */
  21. /*       We'll see more of the debugging features as we proceed...          */
  22. /*                                                                          */
  23. /*   WE RECOMMEND THAT YOU EXIT THE PROGRAM WHEN THE ERROR WINDOW OCCURS!   */
  24. /*                                                                          */
  25. /*                                                         Dr. Boyd Gafford */
  26. /*                                                         Kevin Huck       */
  27. /*                                                         EnQue Software   */
  28. /*                                                         08/31/92         */
  29. /****************************************************************************/
  30. #define SOURCE_TRACE 1
  31. #include <ctype.h>
  32. #include "uw.h"                           /* include the necessary headers  */
  33.  
  34. /*----------------------- global window variables --------------------------*/
  35. WINDOW   Window1;
  36.  
  37. /*********/
  38. /* ~main */
  39. /*       ********************************************************************/
  40. /*  Show basic debugging facility.                                          */
  41. /****************************************************************************/
  42. int main()
  43. {
  44.   int i;
  45.   WINDOW *wnp;
  46.   
  47.   wnp = &Window1;                         /* set local window pointer       */
  48.   init_video(80, 25);                     /* init video for 80 x 25 screen  */
  49.   wn_create(20, 5, 60, 20, SLD_BDR, WN_POPUP, wnp);        /* create window */
  50.   wn_set(wnp);                            /* display window in screen       */
  51.   wn_plst( CENTERED, 3, "Hello world from UltraWin!", wnp);
  52.   for( i = 0; i < 4; i++ )
  53.   wn_plst( CENTERED, 4, "Hello world from UltraWin!", wnp);
  54.   wn_st( "Hello world from UltraWin!", wnp);
  55.   wn_plst( CENTERED, 23, "Hello world from UltraWin!", wnp); /*write outside*/
  56.   wait_event();                           /* wait for a keystroke           */
  57.   wn_destroy(wnp);                        /* remove the window from screen  */
  58.   end_video();                            /* clean up before we exit        */
  59.   return(1);
  60. }
  61. /*** end of main ***/
  62.  
  63. /*** END OF FILE ***/
  64.